package solutions.ferpa.ztest.intf;

import br.com.telescope.adsrt.dom.DomDouble;
import br.com.telescope.adsrt.dom.DomId;
import br.com.telescope.adsrt.dom.DomTextLong;
import br.com.telescope.adsrt.dom.DomUpper;
import br.com.telescope.t2.ServiceModel;
import br.com.telescope.t2.feature.DeleteFeature;
import br.com.telescope.t2.feature.InsertFeature;
import br.com.telescope.t2.feature.ListFeature;
import br.com.telescope.t2.feature.QueryFeature;
import br.com.telescope.t2.feature.UpdateFeature;
import br.com.telescope.t2.feature.ViewFeature;
import solutions.ferpa.ztest.ent.*;

/**
 * Classes do modelos de hidrômetros.
 * <p>
 * Interface para manutenção de Classe do modelo de hidrômetro
 * <P>
 * Telescope origin: ZTEST.CAD_CLASSE_MODELO
 * <P>
 * Base entity: ZTEST.CLASSE_MODELO
 * <P>
 * @author TELESCOPE - Build task T2 Web Interface Generator
 * <P>
 * @version 0.1
 */
public class CadClasseModelo extends ServiceModel {
    
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    public static final String GLOBAL_NAME = "ZTEST.CAD_CLASSE_MODELO";
    
    @Override
    public String globalName() {
        return GLOBAL_NAME;
    }
    
    {
        setTitle("Classes do modelos de hidrômetros");
    }
    
    protected EntClasseModelo base;
    protected EntClasseModelo rec; // NEED_TJW1_COMPATIBILITY
    
    // Record items
    private DomUpper aCodigo;
    private DomTextLong aDescricao;
    private DomDouble aRazao1;
    private DomDouble aRazao2;
    private DomDouble aRazao3;
    private DomDouble aRazao4;
    private DomDouble aRazao5;
    private DomDouble aRazao6;
    private DomDouble aRazao7;
    private DomDouble aRazao8;
    private DomDouble aRazao9;
    private DomDouble aRazao10;
    private DomId aId;
    
    // Query items
    private DomTextLong qDescricao;
    private DomUpper qCodigo;
    private DomDouble qRazao9;
    private DomDouble qRazao1;
    private DomDouble qRazao10;
    private DomDouble qRazao2;
    private DomDouble qRazao3;
    private DomDouble qRazao4;
    private DomDouble qRazao5;
    private DomDouble qRazao6;
    private DomDouble qRazao7;
    private DomDouble qRazao8;
    
    @Override
    public String getBaseSql() {
        return "select BASE.*"
                + " from CLASSE_MODELO BASE";
    }
    
    @Override
    public void initAttributes() {
        
        aCodigo = new DomUpper();
        aCodigo.context(ctx).name("CODIGO").label("Classe metrológica");
        
        aDescricao = new DomTextLong();
        aDescricao.context(ctx).name("DESCRICAO").label("Descrição da classe metrológica");
        
        aRazao1 = new DomDouble();
        aRazao1.context(ctx).name("RAZAO1").label("Razão da vazão (índice 1)").summary(true);
        
        aRazao2 = new DomDouble();
        aRazao2.context(ctx).name("RAZAO2").label("Razão da vazão (índice 2)").summary(true);
        
        aRazao3 = new DomDouble();
        aRazao3.context(ctx).name("RAZAO3").label("Razão da vazão (índice 3)").summary(true);
        
        aRazao4 = new DomDouble();
        aRazao4.context(ctx).name("RAZAO4").label("Razão da vazão (índice 4)").summary(true);
        
        aRazao5 = new DomDouble();
        aRazao5.context(ctx).name("RAZAO5").label("Razão da vazão (índice 5)").summary(true);
        
        aRazao6 = new DomDouble();
        aRazao6.context(ctx).name("RAZAO6").label("Razão da vazão (índice 6)").summary(true);
        
        aRazao7 = new DomDouble();
        aRazao7.context(ctx).name("RAZAO7").label("Razão da vazão (índice 7)").summary(true);
        
        aRazao8 = new DomDouble();
        aRazao8.context(ctx).name("RAZAO8").label("Razão da vazão (índice 8)").summary(true);
        
        aRazao9 = new DomDouble();
        aRazao9.context(ctx).name("RAZAO9").label("Razão da vazão (índice 9)").summary(true);
        
        aRazao10 = new DomDouble();
        aRazao10.context(ctx).name("RAZAO10").label("Razão da vazão (índice 10)").summary(true);
        
        aId = new DomId();
        aId.context(ctx).name("ID").label("Id");
        
        
        qDescricao = new DomTextLong();
        qDescricao.context(ctx).name("DESCRICAO").label("Descrição da classe metrológica");
        
        qCodigo = new DomUpper();
        qCodigo.context(ctx).name("CODIGO").label("Classe metrológica");
        
        qRazao9 = new DomDouble();
        qRazao9.context(ctx).name("RAZAO9").label("Razão da vazão (índice 9)");
        
        qRazao1 = new DomDouble();
        qRazao1.context(ctx).name("RAZAO1").label("Razão da vazão (índice 1)");
        
        qRazao10 = new DomDouble();
        qRazao10.context(ctx).name("RAZAO10").label("Razão da vazão (índice 10)");
        
        qRazao2 = new DomDouble();
        qRazao2.context(ctx).name("RAZAO2").label("Razão da vazão (índice 2)");
        
        qRazao3 = new DomDouble();
        qRazao3.context(ctx).name("RAZAO3").label("Razão da vazão (índice 3)");
        
        qRazao4 = new DomDouble();
        qRazao4.context(ctx).name("RAZAO4").label("Razão da vazão (índice 4)");
        
        qRazao5 = new DomDouble();
        qRazao5.context(ctx).name("RAZAO5").label("Razão da vazão (índice 5)");
        
        qRazao6 = new DomDouble();
        qRazao6.context(ctx).name("RAZAO6").label("Razão da vazão (índice 6)");
        
        qRazao7 = new DomDouble();
        qRazao7.context(ctx).name("RAZAO7").label("Razão da vazão (índice 7)");
        
        qRazao8 = new DomDouble();
        qRazao8.context(ctx).name("RAZAO8").label("Razão da vazão (índice 8)");
    }
    
    @Override
    public String getQueryPkColumn() {
        return "BASE.ID";
    }
    
    @Override
    public void setId(String value) {
        this.aId.setValue(value);
    }
    
    @Override
    public EntClasseModelo getRecord() {
        if (base == null) {
            base = new EntClasseModelo(ctx);
            rec = base;
        }
        return this.base;
    }
    
    @Override
    public String getContextName() {
        return aCodigo.toText();
    }
    
    @Override
    public String getDefaultOrderBy() {
        return "CODIGO, DESCRICAO, RAZAO1";
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="QUERY">
    public class FQuery extends QueryFeature {
        
        @Override
        public void initForm() {
            addField(qCodigo, "opt");
            addField(qDescricao, "opt");
            addField(qRazao1, "opt");
            addField(qRazao2, "opt");
            addField(qRazao3, "opt");
            addField(qRazao4, "opt");
            addField(qRazao5, "opt");
            addField(qRazao6, "opt");
            addField(qRazao7, "opt");
            addField(qRazao8, "opt");
            addField(qRazao9, "opt");
            addField(qRazao10, "opt");
        }
        
        {
            setFeatureName("QUERY");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="LIST">
    public class FList extends ListFeature {
        
        @Override
        public void initForm() {
            addField(aCodigo, "view");
            addField(aDescricao, "view");
            addField(aRazao1, "view");
        }
        
        {
            setFeatureName("LIST");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="VIEW">
    public class FView extends ViewFeature {
        
        @Override
        public void initForm() {
            addField(aCodigo, "view");
            addField(aDescricao, "view");
            addField(aRazao1, "view");
            addField(aRazao2, "view");
            addField(aRazao3, "view");
            addField(aRazao4, "view");
            addField(aRazao5, "view");
            addField(aRazao6, "view");
            addField(aRazao7, "view");
            addField(aRazao8, "view");
            addField(aRazao9, "view");
            addField(aRazao10, "view");
        }
        
        {
            setFeatureName("VIEW");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="INSERT">
    public class FInsert extends InsertFeature {
        
        @Override
        public void initForm() {
            aCodigo.setOptional(false);
            addField(aCodigo, "rqd");
            addField(aDescricao, "opt");
            addField(aRazao1, "opt");
            addField(aRazao2, "opt");
            addField(aRazao3, "opt");
            addField(aRazao4, "opt");
            addField(aRazao5, "opt");
            addField(aRazao6, "opt");
            addField(aRazao7, "opt");
            addField(aRazao8, "opt");
            addField(aRazao9, "opt");
            addField(aRazao10, "opt");
        }
        
        {
            setFeatureName("INSERT");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="UPDATE">
    public class FUpdate extends UpdateFeature {
        
        @Override
        public void initForm() {
            aCodigo.setOptional(false);
            addField(aCodigo, "rqd");
            addField(aDescricao, "opt");
            addField(aRazao1, "opt");
            addField(aRazao2, "opt");
            addField(aRazao3, "opt");
            addField(aRazao4, "opt");
            addField(aRazao5, "opt");
            addField(aRazao6, "opt");
            addField(aRazao7, "opt");
            addField(aRazao8, "opt");
            addField(aRazao9, "opt");
            addField(aRazao10, "opt");
        }
        
        {
            setFeatureName("UPDATE");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="DELETE">
    public class FDelete extends DeleteFeature {
        
        @Override
        public void initForm() {
            addField(aCodigo, "view");
            addField(aDescricao, "view");
            addField(aRazao1, "view");
        }
        
        {
            setFeatureName("DELETE");
            setPrimary(false);
        }
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="initFeatures">
    
    @Override
    protected void initFeatures() {
        addFeature(new FQuery());
        addFeature(new FList());
        addFeature(new FView());
        addFeature(new FInsert());
        addFeature(new FUpdate());
        addFeature(new FDelete());
        super.initFeatures();
    }
    
    @Override
    public String getDefaultFeature() {
        return "QUERY";
    }
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="Getters and Setters">
    
    public String getCodigo() {
        return aCodigo.getValue();
    }
    
    public void setCodigo(String value) {
        this.aCodigo.setValue(value);
    }
    
    public String getDescricao() {
        return aDescricao.getValue();
    }
    
    public void setDescricao(String value) {
        this.aDescricao.setValue(value);
    }
    
    public Double getRazao1() {
        return aRazao1.getValue();
    }
    
    public void setRazao1(Double value) {
        this.aRazao1.setValue(value);
    }
    
    public Double getRazao2() {
        return aRazao2.getValue();
    }
    
    public void setRazao2(Double value) {
        this.aRazao2.setValue(value);
    }
    
    public Double getRazao3() {
        return aRazao3.getValue();
    }
    
    public void setRazao3(Double value) {
        this.aRazao3.setValue(value);
    }
    
    public Double getRazao4() {
        return aRazao4.getValue();
    }
    
    public void setRazao4(Double value) {
        this.aRazao4.setValue(value);
    }
    
    public Double getRazao5() {
        return aRazao5.getValue();
    }
    
    public void setRazao5(Double value) {
        this.aRazao5.setValue(value);
    }
    
    public Double getRazao6() {
        return aRazao6.getValue();
    }
    
    public void setRazao6(Double value) {
        this.aRazao6.setValue(value);
    }
    
    public Double getRazao7() {
        return aRazao7.getValue();
    }
    
    public void setRazao7(Double value) {
        this.aRazao7.setValue(value);
    }
    
    public Double getRazao8() {
        return aRazao8.getValue();
    }
    
    public void setRazao8(Double value) {
        this.aRazao8.setValue(value);
    }
    
    public Double getRazao9() {
        return aRazao9.getValue();
    }
    
    public void setRazao9(Double value) {
        this.aRazao9.setValue(value);
    }
    
    public Double getRazao10() {
        return aRazao10.getValue();
    }
    
    public void setRazao10(Double value) {
        this.aRazao10.setValue(value);
    }
    
    @Override
    public Long getId() {
        return aId.getValue();
    }
    
    public void setId(Long value) {
        this.aId.setValue(value);
    }
    public String getQueryCodigo() {
        return qCodigo.getQueryValue();
    }
    
    public void setQueryCodigo(String value) {
        this.qCodigo.setQueryValue(value);
    }
    public String getQueryDescricao() {
        return qDescricao.getQueryValue();
    }
    
    public void setQueryDescricao(String value) {
        this.qDescricao.setQueryValue(value);
    }
    public String getQueryRazao1() {
        return qRazao1.getQueryValue();
    }
    
    public void setQueryRazao1(String value) {
        this.qRazao1.setQueryValue(value);
    }
    public String getQueryRazao2() {
        return qRazao2.getQueryValue();
    }
    
    public void setQueryRazao2(String value) {
        this.qRazao2.setQueryValue(value);
    }
    public String getQueryRazao3() {
        return qRazao3.getQueryValue();
    }
    
    public void setQueryRazao3(String value) {
        this.qRazao3.setQueryValue(value);
    }
    public String getQueryRazao4() {
        return qRazao4.getQueryValue();
    }
    
    public void setQueryRazao4(String value) {
        this.qRazao4.setQueryValue(value);
    }
    public String getQueryRazao5() {
        return qRazao5.getQueryValue();
    }
    
    public void setQueryRazao5(String value) {
        this.qRazao5.setQueryValue(value);
    }
    public String getQueryRazao6() {
        return qRazao6.getQueryValue();
    }
    
    public void setQueryRazao6(String value) {
        this.qRazao6.setQueryValue(value);
    }
    public String getQueryRazao7() {
        return qRazao7.getQueryValue();
    }
    
    public void setQueryRazao7(String value) {
        this.qRazao7.setQueryValue(value);
    }
    public String getQueryRazao8() {
        return qRazao8.getQueryValue();
    }
    
    public void setQueryRazao8(String value) {
        this.qRazao8.setQueryValue(value);
    }
    public String getQueryRazao9() {
        return qRazao9.getQueryValue();
    }
    
    public void setQueryRazao9(String value) {
        this.qRazao9.setQueryValue(value);
    }
    public String getQueryRazao10() {
        return qRazao10.getQueryValue();
    }
    
    public void setQueryRazao10(String value) {
        this.qRazao10.setQueryValue(value);
    }
    // </editor-fold>
    
}
